<?php
/**
 * Handles the authentication of users.
 * @copyright Nicolas Schudel 2008
 * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License
 */

class User {
	
	private static $_instance = null;
	private $ip;
	
	function __construct() {
		$this->ip = $_SERVER["REMOTE_ADDR"] ;
	}
	
	protected function __clone() {
	  // restricts cloning of the object
	}
	
	static public function getInstance() {
		if(is_null(self::$_instance)) {
			self::$_instance = new self();
		}
		return self::$_instance;
	}
	
	public function authenticate() {
		/* 
		 * This currently tests for specific IP addresses since POS systems 
		 * usually stay in the same place.
		 */
		if (strpos($this->ip,'127.0.') == 0) return true;
		else return false;
	}
}
?>
